from LeetCoder import *



class Solution:

    def isFascinating(self, n: int) -> bool:
        s = str(n) + str(n * 2) + str(n * 3)
        cnt = Counter(s)
        if '0' in cnt:
            return False
        if len(cnt) != 9:
            return False
        for k, y in cnt.items():
            if y != 1:
                return False
        return True
s = Solution()
print(s.isFascinating(267))
